<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="echarts/echarts.js"></script>
<script type="text/javascript">
// 路径配置
require.config({
    paths: {
        echarts: 'echarts'
    }
});

//使用echart
require(
    [
        'echarts',
        'echarts/chart/line' // 使用折线图就加载bar模块，按需加载
    ],
    function (ec) {
     //1.获得图表对象
     var myechart=ec.init(document.getElementById("main"));

   var  option = {
		    title : {
		        text: '2018年每月营业额',
		        subtext: '单位/￥'
		    },
		    tooltip : {
		        trigger: 'axis'
		    },
		    legend: {
		        data:['最高收入','最低收入']
		    },
		    toolbox: {
		        show : true,
		        feature : {
		            mark : {show: true},
		            dataView : {show: true, readOnly: false},
		            magicType : {show: true, type: ['line', 'bar']},
		            restore : {show: true},
		            saveAsImage : {show: true}
		        }
		    },
		    calculable : true,
		    xAxis : [           //x轴
		        {
		            type : 'category',
		            boundaryGap : false,
		            data : ${list}.get("月份")
		            //data : ['周一','周二','周三','周四','周五','周六','周日']
		        }
		    ],
		    yAxis : [			//y轴
		        {
		            type : 'value',
		            axisLabel : {
		                formatter: '{value} °C'
		            }
		        }
		    ],
		    series : [
		        {
		            name:'最高气温',
		            type:'line',
		            data:${list}.get("营业额"),
		           // data:[11, 11, 15, 13, 12, 13, 10],
		             markPoint : {
		                data : [
		                    {type : 'max', name: '最大值'},
		                    {type : 'min', name: '最小值'}
		                ]
		            }, 
		            markLine : {
		                data : [
		                    {type : 'average', name: '平均值'}
		                ]
		            }
		        },
		        {
		            name:'最低气温',
		            type:'line',
		            data:[1, -2, 2, 5, 3, 2, 0],
		            markPoint : {
		                data : [
		                    {name : '周最低', value : -2, xAxis: 1, yAxis: -1.5}
		                ]
		            },
		            markLine : {
		                data : [
		                    {type : 'average', name : '平均值'}
		                ]
		            }
		        }
		    ]
		};
		                    
    		                    
    		          

     //2.设置图表参数
     myechart.setOption(option);	
 });
 
</script>

 <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
     <div id="main" style="height:350px; width:600px;"></div> 




